package com.grantheath.erebus.controller.transitionManagers.linearTransitionManagers
{
	import com.grantheath.erebus.model.enum.notifications.ErebusPreloaderNotifications;
	import com.grantheath.erebus.model.enum.notifications.ErebusPageNotifications;
	import com.grantheath.erebus.model.interfaces.IErebusPageNode;

	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 * @author grantheath
	 */
	public class ErebusPreloaderHiddenCommand extends SimpleCommand implements ICommand 
	{
		override public function execute(notification : INotification) : void
		{
			var pageNode : IErebusPageNode = notification.getBody() as IErebusPageNode;
			
			trace("preloader hidden for page: " + pageNode);
			if(pageNode.pagePreloader){
				sendNotification(ErebusPreloaderNotifications.CLEAR_PRELOADER_TRANSITION_EVENTS, pageNode);
				pageNode.pagePreloader.unitializePreloader();
				pageNode.pagePreloader = null;
			}
			sendNotification(ErebusPageNotifications.SHOW_PAGE, pageNode);
		}
	}
}